package com.anzia.stream;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

/**
 *@ClassName com.anzia.stream.FileOutputStream_Copy
 *@Description
 *@Author Anzia.
 *@Date 2021/4/8 22:26
 *@Version 1.0
 **/
public class FileOutputStream_Copy {

    public static void main(String[] args) throws Exception {

        //创建流
        //文件字节输入流
        FileInputStream fis = new FileInputStream("static\\index.png");
        //文件字节输出流
        FileOutputStream fos = new FileOutputStream("static\\copy.png");

        //边读边写
        byte[] bytes = new byte[1024];
        int count = 0;
        while ((count = fis.read(bytes)) != -1) {
            fos.write(bytes,0,count);
        }

        fis.close();
        fos.close();
        System.out.println("复制完毕！");

    }

}
